package com.byb.server.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.springframework.data.elasticsearch.annotations.Document;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;

/**
 * 保障范围评分
 */
@ApiModel(description = "保障范围评分")
@Entity
@Table(name = "ensure_index_2")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
@Document(indexName = "ensureindex2")
public class EnsureIndex2 implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 二级指标名
     */
    @ApiModelProperty(value = "二级指标名")
    @Column(name = "index_2")
    private String index2;

    /**
     * 指标评价保险内容
     */
    @ApiModelProperty(value = "指标评价保险内容")
    @Column(name = "index_2_info")
    private String index2Info;

    /**
     * 得分
     */
    @NotNull
    @ApiModelProperty(value = "得分", required = true)
    @Column(name = "score", nullable = false)
    private String score;

    /**
     * 二级指标描述
     */
    @ApiModelProperty(value = "二级指标描述")
    @Lob
    @Column(name = "index_2_description")
    private String index2Description;

    @ManyToOne
    private Product product;

    @ManyToOne
    private EnsureScope ensureScope;

    // jhipster-needle-entity-add-field - Jhipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getIndex2() {
        return index2;
    }

    public EnsureIndex2 index2(String index2) {
        this.index2 = index2;
        return this;
    }

    public void setIndex2(String index2) {
        this.index2 = index2;
    }

    public String getIndex2Info() {
        return index2Info;
    }

    public EnsureIndex2 index2Info(String index2Info) {
        this.index2Info = index2Info;
        return this;
    }

    public void setIndex2Info(String index2Info) {
        this.index2Info = index2Info;
    }

    public String getScore() {
        return score;
    }

    public EnsureIndex2 score(String score) {
        this.score = score;
        return this;
    }

    public void setScore(String score) {
        this.score = score;
    }

    public String getIndex2Description() {
        return index2Description;
    }

    public EnsureIndex2 index2Description(String index2Description) {
        this.index2Description = index2Description;
        return this;
    }

    public void setIndex2Description(String index2Description) {
        this.index2Description = index2Description;
    }

    public Product getProduct() {
        return product;
    }

    public EnsureIndex2 product(Product product) {
        this.product = product;
        return this;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public EnsureScope getEnsureScope() {
        return ensureScope;
    }

    public EnsureIndex2 ensureScope(EnsureScope ensureScope) {
        this.ensureScope = ensureScope;
        return this;
    }

    public void setEnsureScope(EnsureScope ensureScope) {
        this.ensureScope = ensureScope;
    }
    // jhipster-needle-entity-add-getters-setters - Jhipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        EnsureIndex2 ensureIndex2 = (EnsureIndex2) o;
        if (ensureIndex2.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), ensureIndex2.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "EnsureIndex2{" +
            "id=" + getId() +
            ", index2='" + getIndex2() + "'" +
            ", index2Info='" + getIndex2Info() + "'" +
            ", score='" + getScore() + "'" +
            ", index2Description='" + getIndex2Description() + "'" +
            "}";
    }
}
